#include "StdAfx.h"
#include <gtest/gtest.h>
#include <utility/utility.h>
#include <utility/pool1.hpp>
#include <utility/threadpool/threadpool.hpp>
#include <boost/thread.hpp>

#if 0

using namespace Zen::utility;
using namespace boost;

//class executor;
using namespace boost::threadpool;

void sleep2()
{
	printf("%d: %s\n", this_thread::get_id(), __FUNCTION__);
	this_thread::interruptible_wait(2000);
}

void sleep5()
{
	printf("%d: %s\n", this_thread::get_id(), __FUNCTION__);
	this_thread::interruptible_wait(5000);
}

TEST(utility, boost_thread_pool)
{
	pool pl(2);
	for (int i = 0; i < 10; i++)
	{
		pl.schedule(sleep2);
		pl.schedule(sleep5);
		int x = pl.active();
		int y = pl.pending();
		int z = pl.size();
	}

	while (1)
		Sleep(10);
}
#endif
#if 0
TEST(utility, adj_pool)
{
	executor ex(2);

	for (int i = 0; i < 10; i++)
	{
		ex.submit(sleep2);
		ex.submit(sleep5);
	}

	while (1)
		Sleep(10);
	//ex.wait();
}

#endif